//
//  LeftSortsViewController.m
//  SS-FXYX
//
//  Created by paycloud110 on 16/4/22.
//  Copyright © 2016年 paycloud110. All rights reserved.
//

#import "LeftSortsViewController.h"
#import "AppDelegate.h"

#define CellID @"Identifier"

@interface LeftSortsViewController () <UITableViewDelegate,UITableViewDataSource>

@end

@implementation LeftSortsViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setUpViewController];
}
/** 初始化背景 */
- (void)setUpViewController
{
    UIImageView *imageview = [[UIImageView alloc] initWithFrame:self.view.bounds];
    imageview.image = [UIImage imageNamed:@"leftbackiamge"];
    [self.view addSubview:imageview];
    
    [self.tableview registerClass:[UITableViewCell class] forCellReuseIdentifier:CellID];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 7;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.font = [UIFont systemFontOfSize:20.0f];
    cell.backgroundColor = [UIColor clearColor];
    cell.textLabel.textColor = [UIColor whiteColor];
    
    if (indexPath.row == 0) {
        cell.textLabel.text = @"消息通知";
    } else if (indexPath.row == 1) {
        cell.textLabel.text = @"我的排行";
    } else if (indexPath.row == 2) {
        cell.textLabel.text = @"积分商城";
    } else if (indexPath.row == 3) {
        cell.textLabel.text = @"企业群组";
    } else if (indexPath.row == 4) {
        cell.textLabel.text = @"应用服务";
    } else if (indexPath.row == 5) {
        cell.textLabel.text = @"微信运动";
    } else if (indexPath.row == 6) {
        cell.textLabel.text = @"QQ健康";
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [tempAppDelegate.LeftSlideVC closeLeftView];//关闭左侧抽屉
    // 弹出其他的控制器
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 180;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableview.bounds.size.width, 180)];
    view.backgroundColor = [UIColor whiteColor];
    return view;
}
- (UITableView *)tableview
{
    if (_tableview == nil) {
        _tableview = [[UITableView alloc] init];
        _tableview.frame = self.view.bounds;
        _tableview.dataSource = self;
        _tableview.delegate  = self;
        _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self.view addSubview:_tableview];
    }
    return _tableview;
}
@end
